﻿using System.Windows;
using System.Windows.Forms;
using GalaSoft.MvvmLight.Messaging;
using SfdClient.Messaging;

namespace SfdClient.View
{
    /// <summary>
    /// Interaction logic for Account1EditorView.xaml
    /// </summary>
    public partial class AccountEditorView
    {
        public AccountEditorView()
        {
            InitializeComponent();

            //Messenger.Default.Register<CloseDialogMessage>(this, message => Close());

            Messenger.Default.Register<SelectFolderMessage>(
                this,
                msg =>
                    {
                        string folder = null;
                        using (var fbd = new FolderBrowserDialog())
                        {
                            var result = fbd.ShowDialog();
                            
                            if (result == DialogResult.OK)
                            {
                                folder = fbd.SelectedPath;
                            }
                            
                        }
                        msg.ProcessCallback(folder);
                    });
        }
    }
}
